<template>
  <div class="topBg">
    <span class="iconfont">&#xe60a;</span>
  </div>
  <div class="top">
    <img src="../../img/avatar.jpg" alt="" class="top__img" />
    <div class="top__name">
      热心市民李先生
      <span class="top__name__tag">
        <img src="../../img/star.png" alt="" />
        16
      </span>
    </div>
    <p class="top__id">ID: 1069643013</p>
    <div class="top__mes">
      <div class="top__mes__item">
        <div class="top__mes__item--top">红包</div>
        <div class="top__mes__item--bottom">218</div>
      </div>
      <div class="top__mes__item">
        <div class="top__mes__item--top">优惠券</div>
        <div class="top__mes__item--bottom">12张</div>
      </div>
      <div class="top__mes__item">
        <div class="top__mes__item--top">鲜豆</div>
        <div class="top__mes__item--bottom">88</div>
      </div>
      <div class="top__mes__item">
        <div class="top__mes__item--top">白条</div>
        <div class="top__mes__item--bottom">1000</div>
      </div>
    </div>
  </div>
  <div class="bottom">
      <p class="bottom__item">
          <img src="../../img/money.png" alt="" class="bottom__item__img img-1">
          <span class="bottom__item__text">我的钱包</span>
          <span class="iconfont bottom__item__icon">&#xe65e;</span>
      </p>
      <p class="bottom__item" @click="handleClick">
          <img src="../../img/address.png" alt="" class="bottom__item__img img-2">
          <span class="bottom__item__text">我的地址</span>
          <span class="iconfont bottom__item__icon">&#xe65e;</span>
      </p>
      <p class="bottom__item">
          <img src="../../img/help.png" alt="" class="bottom__item__img img-3">
          <span class="bottom__item__text">客服与帮助</span>
          <span class="iconfont bottom__item__icon">&#xe65e;</span>
      </p>
  </div>
  <Docker :n="3" />
</template>

<script>
import Docker from "../../components/Docker";
import {useRouter} from 'vue-router';

const useHandleClick=()=>{
    const router=useRouter();
    // 点击“我的地址”跳转到地址管理页面
    const handleClick=()=>{
        router.push({name:'MyAddress'})
    }
    return {handleClick};
}

export default {
  name: "My",
  components: { Docker },
  setup(){
      const {handleClick}=useHandleClick();
      return {
          handleClick,
      }
  }
};
</script>

<style lang="scss" scoped>
@import "../../style/viriables";
p {
  padding: 0;
  margin: 0;
}
.topBg {
  height: 2.34rem;
  background-image: linear-gradient(239deg, #3a6ff3 0%, #50c7fb 100%);
  border-bottom-left-radius: 90% 40%;
  border-bottom-right-radius: 90% 40%;
  position: relative;
  .iconfont {
    font-size: 0.2rem;
    position: absolute;
    top: 0.4rem;
    right: 0.2rem;
    color: #fff;
  }
}
.top {
  position: absolute;
  top: 0.92rem;
  left: 0.18rem;
  right: 0.18rem;
  background-color: #fff;
  box-shadow: 0 0.08rem 0.16rem 0 rgba(0, 0, 0, 0.08);
  border-radius: 0.08rem;
  height: 2.03rem;
  margin: 0;
  &__img {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0.94rem;
    height: 0.94rem;
    border-radius: 50%;
  }
  &__name {
    margin-top: 0.59rem;
    height: 0.36rem;
    line-height: 0.36rem;
    font-size: 0.24rem;
    color: $content-fontcolor;
    text-align: center;
    position: relative;
    &__tag {
      display: inline-block;
      position: absolute;
      right: 0.37rem;
      top: 0.1rem;
      width: 0.35rem;
      height: 0.16rem;
      background-image: linear-gradient(180deg, #bee700 0%, #8aca00 100%);
      border-radius: 0.08rem;
      font-size: 0.12rem;
      color: #fff;
      line-height: 0.16rem;
      img {
        width: 0.11rem;
        height: 0.11rem;
      }
    }
  }
  &__id {
    height: 0.17rem;
    line-height: 0.17rem;
    font-size: 0.14rem;
    color: $border-color;
    text-align: center;
    margin-top: 0.02rem;
    margin-bottom: 0.12rem;
  }
  &__mes {
    display: flex;
    border-top: 1px solid $content-bgcolor;
    &__item {
      flex: 1;
      text-align: center;
      padding-top: 0.12rem;
      padding-bottom: 0.16rem;
      &--top {
        height: 0.17rem;
        line-height: 0.17rem;
        font-size: 0.12rem;
        color: $border-color;
        margin-bottom: 0.03rem;
      }
      &--bottom {
        height: 0.28rem;
        line-height: 0.28rem;
        color: $content-fontcolor;
        font-size: 0.2rem;
      }
    }
  }
}
.bottom {
  position: absolute;
  top: 3.11rem;
  left: 0.18rem;
  right: 0.18rem;
  height: 1.46rem;
  background-color: #fff;
  box-shadow: 0 0.08rem 0.16rem 0 rgba(0, 0, 0, 0.08);
  border-radius: 0.08rem;
  display:flex;
  flex-direction:column;
  &__item {
      flex:1;
      position:relative;
      &__img {
          width:.22rem;
          height:.22rem;
          margin-left:.16rem;
          border-radius:.08rem;
          position:relative;
          top:.05rem;
      }
      .img-1 {
          background-color:$content-highlightcolor;
      }
      .img-2 {
          background-color:$btn-ligjtbgcolor;
      }
      .img-3 {
          background-color: rgba(144,19,254,0.92);
      }
      &__text {
          margin-left:.12rem;
          color:$content-fontcolor;
          font-size:.14rem;
          line-height:.486rem;
      }
      &__icon {
          font-size:.12rem;
          transform:rotate(180deg);
          position:absolute;
          right:.16rem;
          top:.21rem;
      }
  }
}
</style>